package wangwenjun.phase2.concurrencypattern.eventbus.framework;

import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author ChangLiang
 * @date 2020/6/18
 */
public class AsyncEventBus extends BaseEventBus {

    /**
     * 重写了父类EventBus 的构造函数， 使用ThreadPoolExecutor替代Executor
     */

    public static final String DEFAULT_ASYNC_EVENT_BUS_NAME = "default-async-bus";

    /**
     * 最简单使用
     */
    public AsyncEventBus() {
        super(DEFAULT_ASYNC_EVENT_BUS_NAME,null,EventDispatcher.PER_THREAD_EXECUTOR_SERVICE);
    }

    public AsyncEventBus(String eventBusName) {
        super(eventBusName,null,EventDispatcher.PER_THREAD_EXECUTOR_SERVICE);
    }

    public AsyncEventBus(ThreadPoolExecutor executor) {
        this(DEFAULT_ASYNC_EVENT_BUS_NAME, null, executor);
    }

    public AsyncEventBus(String eventBusName, ThreadPoolExecutor executor) {
        super(eventBusName, null, executor);
    }

    public AsyncEventBus(EventExceptionHandler exceptionHandler, ThreadPoolExecutor executor) {
        this(DEFAULT_ASYNC_EVENT_BUS_NAME, exceptionHandler, executor);
    }

    /**
     * 最全使用
     * @param eventBusName
     * @param exceptionHandler
     * @param executor
     */
    public AsyncEventBus(String eventBusName, EventExceptionHandler exceptionHandler, ThreadPoolExecutor executor) {
        super(eventBusName, exceptionHandler, executor);
    }
}
